global !p
import datetime, calendar

lastFriday = datetime.date.today()
oneday = datetime.timedelta(days = 1)

while lastFriday.weekday() != calendar.FRIDAY:
    lastFriday -= oneday

lastMonday = lastFriday
while lastMonday.weekday() != calendar.MONDAY:
    lastMonday -= oneday

# 周报的起止日期
start_end = '{}-{}'.format(lastMonday.strftime('%Y.%m.%d'), lastFriday.strftime('%Y.%m.%d'))

def get_week():
    """ 返回当前年份, 以及当前是第几周 """
    return datetime.datetime.now().isocalendar()

week_num = '{}-{}'.format(get_week()[0], get_week()[1])

# 周报部门, 所属组, 作者姓名
author = 'xxx'
endglobal

snippet title "我的日记标题(Markdown)" b
---
title: `!v strftime("%Y-%m-%d")`
date: `!v strftime("%Y-%m-%d")`
author: `!v g:snips_author`
tags: diary

---


[Current Weekly](weekly/`!p snip.rv=week_num`)

----

## 今日完成

$1

## 今日学习

$2

## 今日草稿

$3

endsnippet


snippet title_wiki "我的日记标题(Wiki版)" b
= `!v strftime("%Y-%m-%d")` =

:diary:

= Contents =

----

[[weekly/`!p snip.rv=week_num`|Current Weekly]]

== 今日完成 ==

$1


== 今日学习 ==

$2

== 今日草稿 ==

endsnippet

snippet coder "代码块" b
{{{

}}}
endsnippet

snippet zhouji "周记开头模板" b
---
title: `!p snip.rv=get_week()[1]`周周记
author: `!v g:snips_author`
tags: 周记

---

endsnippet

snippet zhoubao "周报模板" b
---
title: `!v strftime("%Y-%m-%d")`[周报]
date: `!p snip.rv= start_end`
author: `!v g:snips_author`

---

[周报] `!v g:snip_zhoubao_group`-`!v g:snip_zhoubao_author` (`!p snip.rv= start_end`)


Hi all:

1. 上周工作计划;

    <!-- TODO -->

2. 本周工作完成情况;

    <!-- TODO -->

    起止日期: `!p snip.rv= start_end`

3. 下周工作计划;

    <!-- TODO -->

4. 本周解决的用户问题;

    <!-- TODO -->

endsnippet

snippet huiyi "会议纪要" b


### 最新进展

    <!-- TODO -->

### 运维问题

    <!-- TODO -->

### 新功能讨论

    <!-- TODO -->

### 一些调研分享

    <!-- TODO -->

endsnippet

snippet footer "邮件脚注" b

---------------------------------------

> `!v g:snip_corp_group` `!v g:snip_corp_name`
> 发件日期: `!v strftime("%Y-%m-%d")`
> email: `!v g:snip_corp_mail`
> Tel: `!v g:snip_corp_phone`
endsnippet
